UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xJJ3g6h7OwIkKCTfLbABaeQKRJNpYSB6IZqAs3CHNmw=' 
WHERE 
  key_id = 'dc0bec2ee1fbdd296055bf19da84fd0733155abdc263215150a2f32730eff5b1' 
  AND (
    token = 'xJJ3g6h7OwIkKCTfLbABaeQKRJNpYSB6IZqAs3CHNmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064