UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C+8l/gF2SOtTd6pOwYMOWcb181n5fhMJ/jpIywqJogQ=' 
WHERE 
  key_id = 'c6f6fb566509fa67b0acec3e57402911d2efab1b121be3051723592c1643f8fa' 
  AND (
    token = 'C+8l/gF2SOtTd6pOwYMOWcb181n5fhMJ/jpIywqJogQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032