UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v5Clcb9cIka6pz6xCU5OmzkPkHNn/FSRPhZ7sDYGgZo=' 
WHERE 
  key_id = '27dc31c90a5e78c533e75b286c4cbf8d2d1d22fb8b496ff9a49608a21bc79745' 
  AND (
    token = 'v5Clcb9cIka6pz6xCU5OmzkPkHNn/FSRPhZ7sDYGgZo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020