UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F/8jPdHCtiiZwnGknkMiq/p/vhBWCAaz/sTOh4R1nGg=' 
WHERE 
  key_id = '46b4d0bd27eafdc73778fcd05230f5cfa27992bca50489050e9f990f1af5e4cb' 
  AND (
    token = 'F/8jPdHCtiiZwnGknkMiq/p/vhBWCAaz/sTOh4R1nGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015