UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5xbJvwL7W8k8+SHuEfm5DoenLkg3yKL+Q7anMasH0dg=' 
WHERE 
  key_id = 'f99fb02d18d6c8b8ea0226e2d43531f2028d1fed9e01217e61cac2b4d6679ceb' 
  AND (
    token = '5xbJvwL7W8k8+SHuEfm5DoenLkg3yKL+Q7anMasH0dg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041