UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T0bfM7pJmzpezNa88zAg0u2YVGBtWg8XcJTI6zUbpiQ=' 
WHERE 
  key_id = '4b5ec78fd04fb57f7eced2d89c92510a3cbe4d948490f2e74769207df1d56139' 
  AND (
    token = 'T0bfM7pJmzpezNa88zAg0u2YVGBtWg8XcJTI6zUbpiQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040