UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bT46Iv+uFzAKAE3GWfRxz3e2wH1/VaHwfYhpbS7U8bg=' 
WHERE 
  key_id = '85f3ec8e0726220ba154a251c1aefd8c9046942c0b5f29033f67d9c67293a064' 
  AND (
    token = 'bT46Iv+uFzAKAE3GWfRxz3e2wH1/VaHwfYhpbS7U8bg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024