UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jx21g9VjQUP24AN6dcP1E0qBngEcYiiaCxf4MtgzIac=' 
WHERE 
  key_id = '3a6c08d8cd951f0d0ca8d4b11bea1d279c6248ad0c62472b6a8753ebf359a386' 
  AND (
    token = 'Jx21g9VjQUP24AN6dcP1E0qBngEcYiiaCxf4MtgzIac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022