UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gEsJtqyNVKF+OOL3wXDgVjjmWZRhoqLdi3GJs0oQojE=' 
WHERE 
  key_id = '5f1f2f72b88a4fa94cc2da53e8ce99d99c91e1dfd7b23e3e7addf9b830390236' 
  AND (
    token = 'gEsJtqyNVKF+OOL3wXDgVjjmWZRhoqLdi3GJs0oQojE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050