UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o+LJtaioIB1AiZlDdfKTpX0WVwKVmyItIWTeroxTIrA=' 
WHERE 
  key_id = 'aebe3e40c23556daa83cb1d5eb3cd96109e80381950470ffc4b4403711d42621' 
  AND (
    token = 'o+LJtaioIB1AiZlDdfKTpX0WVwKVmyItIWTeroxTIrA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018