UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0RfFbkY117HAl4uGxp6iNBqS6bal0Moi4FHLFFuWtpc=' 
WHERE 
  key_id = 'bae47cd5615881fcd6283836005c9f53c64dd87a155962a325caf4ea5d8b4f31' 
  AND (
    token = '0RfFbkY117HAl4uGxp6iNBqS6bal0Moi4FHLFFuWtpc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047