UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gpT2QQoltXYwxoABEfJeh+3+4nm5hWgGpfJAFs0tLhc=' 
WHERE 
  key_id = '45efc6dd4ae5bd3111654a4d7dc254b78d46393ff7ed9e746c010595aa4066ce' 
  AND (
    token = 'gpT2QQoltXYwxoABEfJeh+3+4nm5hWgGpfJAFs0tLhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046