UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+TJqOSxdsvS8+nkv6SMvgUQB/5OSYToT/gE2e09uE8=' 
WHERE 
  key_id = '5c45e744571f4f9964230f5247a5216f92b86ed64584c54118b777027e4c80bf' 
  AND (
    token = 'L+TJqOSxdsvS8+nkv6SMvgUQB/5OSYToT/gE2e09uE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027