UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5UrlCZ1BtPkOCboQJpC8YIqHp9unoRXwAu0xTlOO+Gk=' 
WHERE 
  key_id = '3ff8007a8fb9a358de7b67572676f709d0c5bdefa8b20f884678bd57fe0e115d' 
  AND (
    token = '5UrlCZ1BtPkOCboQJpC8YIqHp9unoRXwAu0xTlOO+Gk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054