UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JT/SO+4C+qa/qoq/EN/teMwnr9O4fpolGrH7nkzKNww=' 
WHERE 
  key_id = '0dfbe76315b9133f56b9cdbe804615747fd4857ffd1bd5ca9f12a310525d489e' 
  AND (
    token = 'JT/SO+4C+qa/qoq/EN/teMwnr9O4fpolGrH7nkzKNww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048