UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7u1cbBkZVCNbEx+GliLQjPLKpkIcia7PpY4YdnjJu4U=' 
WHERE 
  key_id = '717ded0b5043789fa4fd4eacc171e4f5365821af996a97e29f655cac0e283e43' 
  AND (
    token = '7u1cbBkZVCNbEx+GliLQjPLKpkIcia7PpY4YdnjJu4U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039