UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fKMOk+tu1+2r870keMVrgcMa720jZl0hz6NGaCQ96gU=' 
WHERE 
  key_id = '4119321dcfcf88c5cf3214a3bc01dfd0a5ca0a8297d53a7679cb4bd06d7d3704' 
  AND (
    token = 'fKMOk+tu1+2r870keMVrgcMa720jZl0hz6NGaCQ96gU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037