UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eCHu+NilvXn9poCBJwHY8iBvg6+VaIVz8yaqDB1za2Y=' 
WHERE 
  key_id = '4454e738b9257244cc35c07f8c7904197fae013c2c8e10f89819c61b4c046bb1' 
  AND (
    token = 'eCHu+NilvXn9poCBJwHY8iBvg6+VaIVz8yaqDB1za2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032