UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gk/TKa5FUaGTeoYYzdhhaA8Wr3cFBa2p9EKy9qaZhs4=' 
WHERE 
  key_id = 'd709d536a738f6b50bb99d31ea39ae1942360102bec5c1df870b2f3f68168d2b' 
  AND (
    token = 'Gk/TKa5FUaGTeoYYzdhhaA8Wr3cFBa2p9EKy9qaZhs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020