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

Query time 0.00035