UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7U9fJqLOmG68eU81o80BC8L0W0v6DssYiuPJ2Xwdu4Q=' 
WHERE 
  key_id = 'dfeb9f4e8672ebad89badb1aa5bff523d9b56d151b7047885bfea96908a1790f' 
  AND (
    token = '7U9fJqLOmG68eU81o80BC8L0W0v6DssYiuPJ2Xwdu4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023