UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vxnoctIn7oy/dNmLy+zq3kV18x4xxnHXfTAfB0reVA8=' 
WHERE 
  key_id = '99813a377c8f05e070c78520876886df9c849f7cbdf1dfb98ce8619c969a2c52' 
  AND (
    token = 'vxnoctIn7oy/dNmLy+zq3kV18x4xxnHXfTAfB0reVA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033