UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E2krY1zTlAdXKhBfer2tcH5OYv/lsEn77WvAJc7ez6A=' 
WHERE 
  key_id = '2b9d31e696f0dd158cab36a9560474f21e9b12136abea1f39cfd502d69853304' 
  AND (
    token = 'E2krY1zTlAdXKhBfer2tcH5OYv/lsEn77WvAJc7ez6A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055