UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UjRk4Mxyr7195j/j+u322/0KV55/l6j+/JJwlTZOwns=' 
WHERE 
  key_id = 'cab80fc45514f82055bbf4e1054d4da9ed0dcb96756557d707fcc7d6fd1b6552' 
  AND (
    token = 'UjRk4Mxyr7195j/j+u322/0KV55/l6j+/JJwlTZOwns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015