UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ztiyF8M6LKuW+NDNJ7BVaXvRim8ncoKwmQTxfYd61RM=' 
WHERE 
  key_id = '5cf1d7ba1a2067427d1f07698a4048d7c1ccfaecdd1666e35f63dc2bffb1040b' 
  AND (
    token = 'ztiyF8M6LKuW+NDNJ7BVaXvRim8ncoKwmQTxfYd61RM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031