UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r/oEbyqjoUBl+6XQMjyctBfft+2thOojmH+lhA4iV+E=' 
WHERE 
  key_id = '21331feac4b0e2927af15836e4edf1fa1d8b992821de89e19a3ca76338d0a9f4' 
  AND (
    token = 'r/oEbyqjoUBl+6XQMjyctBfft+2thOojmH+lhA4iV+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036