UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YXrvA3i7pGgmjZTEF9ymTkZeLA+4afWqe0s418O1fDw=' 
WHERE 
  key_id = '7e7eb602455069891c0da9f156a6489811768d105531b0e9f49ded2f0a53b7fd' 
  AND (
    token = 'YXrvA3i7pGgmjZTEF9ymTkZeLA+4afWqe0s418O1fDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047