UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kk4LcxkhIAs274NhSr1ycUCS2hciBdp8+1mJdr5zBNo=' 
WHERE 
  key_id = 'ced285461871636dd4b616322107d25fccdb8470140b90f85c6679cf4322472f' 
  AND (
    token = 'kk4LcxkhIAs274NhSr1ycUCS2hciBdp8+1mJdr5zBNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077