UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HDCTATAnbWRpFBHqfrkPjl1FngSvxxFqMV0BqQY9w/c=' 
WHERE 
  key_id = '505aa5c441a5748cedd795fdb06ebc51ad0c8487237b8b704004b4c504f37747' 
  AND (
    token = 'HDCTATAnbWRpFBHqfrkPjl1FngSvxxFqMV0BqQY9w/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039