UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ITNfs5yYZhCmIfY9SRoc+qFAwslGIc2lv770EgrCKHU=' 
WHERE 
  key_id = 'a6fc1be63075dac389233cb23ecb4d5d8dabbef33ba58df4e57c7787bbcb19a5' 
  AND (
    token = 'ITNfs5yYZhCmIfY9SRoc+qFAwslGIc2lv770EgrCKHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038