UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hfAGHtV7d8HQqo6ktWF7twVLx84YjiptNi+UxesxLuU=' 
WHERE 
  key_id = '553d97846d374248bc3c225613e3ef24499b57b7b9d550e6066bae2ff461d233' 
  AND (
    token = 'hfAGHtV7d8HQqo6ktWF7twVLx84YjiptNi+UxesxLuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023