UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T3QmduWKbIzthDX77Gzq2FJkjdv7qj+9YcGlE034kRU=' 
WHERE 
  key_id = '3620072d10811d5da116575f99e5a0a8714b883e8fb1e907d66ab3cb786a43fc' 
  AND (
    token = 'T3QmduWKbIzthDX77Gzq2FJkjdv7qj+9YcGlE034kRU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037