UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YUpsKfO6vfvbXg/bO+Nu1fb2xkosqXxftzLIZBQLQB4=' 
WHERE 
  key_id = '25d06d8680dedd30d1a1d6801b141f136b40c0c267249521086541ccf8b4f31d' 
  AND (
    token = 'YUpsKfO6vfvbXg/bO+Nu1fb2xkosqXxftzLIZBQLQB4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043