UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3GuVKK3xdSfs2IHxLQLyC7ABWeuQaYEGCCAKOKbizNs=' 
WHERE 
  key_id = 'dced124b37059bfc5e3b34007f65c22919962195eb69753b6cb6ca991b8c9870' 
  AND (
    token = '3GuVKK3xdSfs2IHxLQLyC7ABWeuQaYEGCCAKOKbizNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047