UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gX4C8wj/Uj5SlgC11DwJ0RH/7WTHbd00j8WvQ0Vshy8=' 
WHERE 
  key_id = '7fbedac541cc4d1d4ab8d7489fca3ecb5862531efa2e1db9cdd616d017f7da0d' 
  AND (
    token = 'gX4C8wj/Uj5SlgC11DwJ0RH/7WTHbd00j8WvQ0Vshy8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021